local doupo = fk.CreateSkill {

  name = "joy_doupo",

  tags = { Skill.Compulsory, },

}



doupo:addEffect(fk.CardUsing, {
  name = "joy_doupo",
  events = {fk.CardUsing},
  anim_type = "offensive",
  frequency = Skill.Compulsory,
  can_trigger = function(self, event, target, player, data)
    if event == fk.CardUsing then
      return player:hasSkill(doupo.name) and data.from == player.id and data.card.trueName == "duel"
    end
  end,
  on_cost = Util.TrueFunc,
  on_use = function(self, event, target, player, data)
    local room = player.room
    if event == fk.CardUsing then
      local card = data.card:clone()
      local c = table.simpleClone(data.card)
      for k, v in pairs(c) do
        card[k] = v
      end
      card.skill = duelSkill
      data.card = card
    end
  end,
})

doupo:addEffect("targetmod", {
  name = "#joy_doupo_targetmod",
  extra_target_func = function(self, player, skill, card)
    if card and card.name == "duel"   then
      return 2
    end
  end,
})

return doupo